package com.day1014.remote;


import javax.jws.soap.SOAPBinding;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class MainText {
    public static void main(String[] args) throws Exception {
        ServerSocket serverSocket = new ServerSocket(11111);
        Socket socket = serverSocket.accept();
        InputStream inputStream = socket.getInputStream();
        File file = new File("F:\\c.png");
        FileOutputStream fileOutputStream = new FileOutputStream(file);
        byte[] bytes = new byte[1024];
        int len = -1;
        while ((len = inputStream.read(bytes)) != -1){
            fileOutputStream.write(bytes,0,len);
        }
        fileOutputStream.flush();
        inputStream.close();
        serverSocket.close();
        socket.close();

    }
}
